<template>
    <div class="dynamicDisplay">
        <div class="top">
            <img :src="data.img"
                alt="">
        </div>
        <div class="dynamicDisplay-container swiper-container">
            <div class="swiper-wrapper">
                <div class="swiper-slide" v-for="item in data.data" :key="item.id">
                    <img :src="item.goods_thumb" alt="">
                    <div class="info">
                        <span class="title">{{ item.title }}</span>
                        <span class="newPrice">{{ item.shop_price_formated }}</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>

import Swiper from 'swiper'

export default {
    props: ["data"],
    data() {
        return {
            swiper: null,
        }
    },
    mounted() {
        new Swiper('.dynamicDisplay-container', {
            slidesPerView: 'auto',
            spaceBetween: 10,
            freeMode: true,
            freeModeSticky: true,
        })
    },

}
</script>

<style scoped>
.dynamicDisplay {
    width: 94.6667vw;
    margin: 2.6667vw auto;
    box-sizing: border-box;
    border-radius: 2.6667vw;
    position: relative;
    height: 89.3333vw;
    overflow: hidden;
}

.top {
    display: flex;
    width: 100%;
    height: 52.8vw;
    object-fit: cover;
    box-sizing: border-box;

    img {
        border-radius: 2.6667vw;
    }
}


.dynamicDisplay-container {
    display: flex;
    width: 94.6667vw;
    flex-direction: column;
    padding-left: 2.6667vw;
    position: relative;
    bottom: 18.6667vw;
    box-sizing: border-box;
    overflow: hidden;
}

.dynamicDisplay-container .swiper-slide {
    width: 29.3333vw;
    display: flex;
    flex-direction: column;
    border-radius: 2.6667vw;
    overflow: hidden;
    .info{
        background-color: #fff;
    }
}

.dynamicDisplay-container img {
    width: 29.3333vw;
    height: 26.6667vw;
}

.dynamicDisplay-container span {
    font-size: 3.2vw;
    display: block;
}

.dynamicDisplay-container .title {
    width: 26.6667vw;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 6.4vw;
    font-size: 3.7333vw;
    padding-left: 2.6667vw;
    box-sizing: border-box;
}

.dynamicDisplay-container .newPrice {
    color: red;
    font-weight: bold;
    font-size: 3.7333vw;
    line-height: 8vw;
    text-align: left;
    padding-left: 2.6667vw;
}
</style>